package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import com.opensymphony.xwork2.ActionSupport;
import com.zr.service.AddorderserviceCH;

public class AddorderActionCH extends ActionSupport implements ServletRequestAware,ServletResponseAware {
	private HttpServletRequest req;
	private HttpServletResponse resp;
	
	private String orSenderName;
	private String orSenderPhone;
	private String orSenderCompanyPhone;
	private String orSenderAddr;
	 private String orRecipientName;
	private  String orRecipientPhone;
	 private String orRecipientCompanyPhone;
	private  String orRecipientAddr;
	 private String orItemName;
	private int orItemNumber;
	 private String orPaymentMethod;
  public String getOrSenderName() {
		return orSenderName;
	}
	public void setOrSenderName(String orSenderName) {
		this.orSenderName = orSenderName;
	}
	public String getOrSenderPhone() {
		return orSenderPhone;
	}
	public void setOrSenderPhone(String orSenderPhone) {
		this.orSenderPhone = orSenderPhone;
	}
	public String getOrSenderCompanyPhone() {
		return orSenderCompanyPhone;
	}
	public void setOrSenderCompanyPhone(String orSenderCompanyPhone) {
		this.orSenderCompanyPhone = orSenderCompanyPhone;
	}
	public String getOrSenderAddr() {
		return orSenderAddr;
	}
	public void setOrSenderAddr(String orSenderAddr) {
		this.orSenderAddr = orSenderAddr;
	}
	public String getOrRecipientName() {
		return orRecipientName;
	}
	public void setOrRecipientName(String orRecipientName) {
		this.orRecipientName = orRecipientName;
	}
	public String getOrRecipientPhone() {
		return orRecipientPhone;
	}
	public void setOrRecipientPhone(String orRecipientPhone) {
		this.orRecipientPhone = orRecipientPhone;
	}
	public String getOrRecipientCompanyPhone() {
		return orRecipientCompanyPhone;
	}
	public void setOrRecipientCompanyPhone(String orRecipientCompanyPhone) {
		this.orRecipientCompanyPhone = orRecipientCompanyPhone;
	}
	public String getOrRecipientAddr() {
		return orRecipientAddr;
	}
	public void setOrRecipientAddr(String orRecipientAddr) {
		this.orRecipientAddr = orRecipientAddr;
	}
	public String getOrItemName() {
		return orItemName;
	}
	public void setOrItemName(String orItemName) {
		this.orItemName = orItemName;
	}
	public int getOrItemNumber() {
		return orItemNumber;
	}
	public void setOrItemNumber(int orItemNumber) {
		this.orItemNumber = orItemNumber;
	}
	public String getOrPaymentMethod() {
		return orPaymentMethod;
	}
	public void setOrPaymentMethod(String orPaymentMethod) {
		this.orPaymentMethod = orPaymentMethod;
	}
public AddorderserviceCH getAds() {
		return ads;
	}
	public void setAds(AddorderserviceCH ads) {
		this.ads = ads;
	}

			//属性注入
			@Resource
			private  AddorderserviceCH ads;
	public void Addorders(){
		resp.setCharacterEncoding("utf-8");
		 try {
			PrintWriter pt=resp.getWriter();
			boolean flag=ads.addorders(orSenderName, orSenderPhone, orSenderCompanyPhone, orSenderAddr, orRecipientName, orRecipientPhone, orRecipientCompanyPhone, orRecipientAddr, orItemName, orItemNumber, orPaymentMethod);
			if(flag){
				 pt.write("1");
			}else{
				 pt.write("0");
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}		
			
			
			
			
	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		// TODO Auto-generated method stub
		this.resp=arg0;
	}

	@Override
	public void setServletRequest(HttpServletRequest arg0) {
		// TODO Auto-generated method stub
		this.req=arg0;
	}

}
